//
//  main.m
//  oc_22
//
//  Created by 楼楚 on 15/9/17.
//  Copyright (c) 2015年 Chu Lou. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Human.h"

int main(int argc, const char * argv[]) {
    @autoreleasepool {
        NSMutableArray *arrList = [[[NSMutableArray alloc]init]autorelease];
        
        for (int i = 0; i<10; ++i) {
            Human *hm =[[Human alloc]init];
            hm.name = [NSString stringWithFormat:@"human %d",i];
            hm.height = i * 10 +100;
            [arrList addObject:hm];
            [hm release];
            
        
        
        
        
        }
//      浅拷贝
//       
//        NSArray *newArr = [[NSArray alloc]initWithArray:arrList];
//        Human *temHm = newArr[0];
//        temHm.name = @"hehehe";
//        NSLog(@"arr is %@",newArr);
//        NSLog(@"%@",arrList);
//        深拷贝
        
        NSArray *arr3 = [[NSArray alloc]initWithArray:arrList copyItems:YES];
        NSLog(@"%@",arr3);

        Human *human = arr3[0];
        human.name =  @"auv";
        NSLog(@"%@",arr3);
        
    }
//     浅拷贝不会开辟新空间  深拷贝必须开辟新空间
    return 0;
}
